from game import *

class Stars(object):

	def __init__(self, game, layers, stars_per_layer):
		self.game = game
		self.layers = []
		
		c = 255
		for i in range(0, layers):
			surface = pygame.Surface((self.game.world.w, self.game.world.h)).convert_alpha()
			surface.fill((0, 0, 0, 0))
			for j in range(0, stars_per_layer):
				pos = Vector.random((0, self.game.world.w-1), (0, self.game.world.h-1))
				surface.set_at(pos.to_list(), (c, c, c))
			surface.set_alpha(255, pygame.RLEACCEL)
			self.layers.append(surface)
			c -= 80
	

	def draw(self):
		d = 1.0
		for layer in self.layers:
			pos = self.game.camera.translate() * d
			self.game.screen.blit(layer, pos.to_list())
			d -= 0.2
			#print d

